package com.xixibaby.core.mybatis;

/**
 * @author : tomj
 * @Date: 2019-02-25 11:05
 * @Description:
 */
public enum SqlMethod {


    SELECT_BY_ID_INCLUD_DELETED("selectByIdIncludDeleted", "根据ID 查询一条数据", "SELECT %s FROM %s WHERE %s=#{%s}"),

    /**
     * left join
     * LEFT JOIN {0} {0} ON {0}.{1} = %s.{2}
     */
    LEFT_JOIN("leftJoin", "LEFT JOIN {0} {0} ON {0}.{1} = {4}.{2}  \n", "<script>\nselect %s from %s %s %s %s\n</script>"),
    /**
     * list join money table
     */
    LIST_INNER_JOIN("listJoin", "{0} \n", "<script>\nselect %s from %s %s %s %s\n</script>");

    private final String method;
    private final String desc;
    private final String sql;

    SqlMethod(String method, String desc, String sql) {
        this.method = method;
        this.desc = desc;
        this.sql = sql;
    }

    public String getMethod() {
        return this.method;
    }

    public String getDesc() {
        return desc;
    }

    public String getSql() {
        return this.sql;
    }
}
